From: Noah Meyerhans Date: Wed, 2 Sep 2026 16:17:57 +0000 (-0400) Subject: lib: xxh64: fix byte ordering issue on big-endian systems X-Git-Tag: archive/raspbian/1%2.4.5+dfsg1-2+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=02d44372efa569639a1e0edfc10bacec5ea0266f;p=dovecot.git lib: xxh64: fix byte ordering issue on big-endian systems Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1146449 Forwarded: https://github.com/dovecot/core/pull/314 Last-Update: 2026-09-01 Last-Update: 2026-09-01 Gbp-Pq: Name xxh64-endian-fix.patch --- diff --git a/src/lib/xxh64.c b/src/lib/xxh64.c index 1c17833..4a151bd 100644 --- a/src/lib/xxh64.c +++ b/src/lib/xxh64.c @@ -8,6 +8,8 @@ #include "lib.h" #include "xxh64.h" +#include + #define XXH64_PRIME1 UINT64_C(0x9E3779B185EBCA87) #define XXH64_PRIME2 UINT64_C(0xC2B2AE3D27D4EB4F) #define XXH64_PRIME3 UINT64_C(0x165667B19E3779F9) @@ -20,14 +22,14 @@ static inline uint64_t xxh64_read64(const void *p) { uint64_t v; memcpy(&v, p, sizeof(v)); - return v; + return le64toh(v); /* Convert from little-endian to host byte order */ } static inline uint32_t xxh64_read32(const void *p) { uint32_t v; memcpy(&v, p, sizeof(v)); - return v; + return le32toh(v); /* Convert from little-endian to host byte order */ } static uint64_t ATTR_UNSIGNED_WRAPS xxh64_round(uint64_t acc, uint64_t input)